﻿var imgUrl = "http://www.btbook.net/static/img/logo.jpg";var lineLink = this.location.href;var descContent = this.document.title;
var shareTitle = this.document.title;var appid = '';
function shareFriend() {
    WeixinJSBridge.invoke('sendAppMessage',{
        "appid": appid,
        "img_url": imgUrl,
        "img_width": "200",
        "img_height": "200",
        "link": lineLink,
        "desc": descContent,
        "title": shareTitle
    }, function(res) {
        //_report('send_msg', res.err_msg);
    })
}
function shareTimeline() {
    WeixinJSBridge.invoke('shareTimeline',{
        "img_url": imgUrl,
        "img_width": "200",
        "img_height": "200",
        "link": lineLink,
        "desc": descContent,
        "title": shareTitle
    }, function(res) {
            //_report('timeline', res.err_msg);
    });
}
function shareWeibo() {
    WeixinJSBridge.invoke('shareWeibo',{
        "content": descContent,
        "url": lineLink,
    }, function(res) {
        //_report('weibo', res.err_msg);
    });
}
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
    WeixinJSBridge.on('menu:share:appmessage', function(argv){
        shareFriend();
    });
    WeixinJSBridge.on('menu:share:timeline', function(argv){
        shareTimeline();
    });
    WeixinJSBridge.on('menu:share:weibo', function(argv){
        shareWeibo();
    });
}, false);
function changeLanguage(language)
{
    if(!language){return;}
	var date = new Date();
	var expireDays = 365;
	date.setTime(date.getTime()+expireDays*24*3600*1000);
	document.cookie="locale="+language+";path=/; expires="+date.toGMTString();
	window.location.reload();
}